import { Body, Controller, Post } from '@nestjs/common';
import { EmailService } from './email.service';
import { ApiOperation } from '@nestjs/swagger';
import { SendCodeDto } from './dto/send-email.dto';
import { Public } from 'src/common/decorators/public';

@Controller('email')
export class EmailController {

  constructor(private readonly emailService: EmailService) {
 
  }
  
  @Post('sendCode')
  @Public()
  @ApiOperation({ summary: '发送验证码' })
  async sendVerificationCode(@Body() sendCodeDto: SendCodeDto) {
    return await this.emailService.sendVerificationCode(sendCodeDto.email);
  }
}
